import { routerRedux } from 'dva/router';
import * as LoginService from '../services/basics';

var roles=[];

export default {
  namespace: 'classMann',
  state: {
    list: [],
    currentUser: {},
  },

  effects: {
		//查询列表
		*queryList({ payload }, { call, put }) {
				const response = yield call(LoginService.get,'/api/web/queryOrganizationClass',payload); 
			yield put({type: 'save',payload: response.data.obj});
		},
		/* 查询所有的教室 */
		*queryClassroom({ payload,callback }, { call, put }) {
			const response = yield call(LoginService.get,'/api/web/classroom/getClassroomList',payload);
			callback(response.data.res,response.data.obj);
		},
		/* 编辑班级信息 */
		*updateClassForm({ payload,callback }, { call, put }) {
			const response = yield call(LoginService.get,'/api/web/updateOrganizationClass',payload);
			callback(response.data.res,response.data.resMsg);
		},
		/* 查看班级进度 */
		*queryClassSchedule({ payload,callback }, { call, put }) {
			const response = yield call(LoginService.get,'/api/web/queryCourseSchedule',payload);
			callback(response.data.res,response.data.obj);
		},
		/* 查看期望时间 */
		*queryExpectTime({ payload,callback }, { call, put }) {
			const response = yield call(LoginService.get,'/api/web/expectTimeReferTo',payload);
			callback(response.data.res,response.data.obj);
		},
		/* 根据所选班级，时间查询班级上课安排时间 */
		*queryTimeByClassAndTime({ payload,callback }, { call, put }) {
			const response = yield call(LoginService.get,'/api/web/employTimeReferTo',payload);
			callback(response.data.res,response.data.obj);
		},
		/* 排班 */
		*replaceClass({ payload,callback }, { call, put }) {
			const response = yield call(LoginService.get,'/api/web/handMovementTeachingSchedule',payload);
			callback(response.data.res,response.data.resMsg);
		},
		/*根据所选小孩绑定的包筛选出教室 */
		*queryClassrommByPackage({ payload,callback }, { call, put }) {
		const response = yield call(LoginService.get,'/api/web/querySlfClassroomPackage',payload); 
		callback(response.data.res,response.data.obj);
		},
  },
  reducers: {
  	save(state, action) {
  		return {
  			...state,
  			data: action.payload,
  		};
  	},
  },
};






